package model;

import java.util.Date;

public class Product {
    private int id;
    private String name;
    private String detail;
    private String cover;
    private String pickup_address;
    private String proxy_address;
    private int receiver_id;
    private String phone_number;
    private int category_id;
    private float price;
    private Date create_time;
    private boolean status;
    private Category category;
    private User user;

    @Override
    public String toString() {
        return "Goods [id=" + id + ", name=" + name + ", detail=" + detail +", cover=" + cover +", pickup_address=" + pickup_address +", proxy_address=" + proxy_address
                + ", receiver_id=" + receiver_id + ", phone_number=" + phone_number + ", category_id=" + category_id + ", price=" + price + ", create_time="
                + create_time + ", status=" + status + "]";
    }
    public void setCategoryid(int typeid) {
        if(category==null) {
            category = new Category();
        }
        category.setId(typeid);
    }
    public void setCategoryname(String typename) {
        if(category==null) {
            category = new Category();
        }
        category.setName(typename);
    }
//    public void setUseravatar(String avatar) {
//        if(user==null) {
//            user = new User();
//        }
//        user.setAvatar(avatar);
//    }
//    public void setUsernickname(String nickname) {
//        if(user==null) {
//            user = new User();
//        }
//        user.setNickname(nickname);
//    }
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getDetail() {
        return detail;
    }
    public void setDetail(String detail) {
        this.detail = detail;
    }
    public String getCover() {
        return cover;
    }
    public void setCover(String cover) {
        this.cover = cover;
    }
    public String getPickup_address() { return pickup_address; }
    public void setPickup_address(String pickup_address) { this.pickup_address = pickup_address; }
    public String getProxy_address() { return proxy_address; }
    public void setProxy_address(String proxy_address) { this.proxy_address = proxy_address; }
    public int getReceiver_id() { return receiver_id; }
    public void setReceiver_id(int receiver_id) { this.receiver_id = receiver_id; }
    public String getPhone_number() { return phone_number; }
    public void setPhone_number(String phone_number) { this.phone_number = phone_number; }
    public int getCategory_id() {
        return category_id;
    }
    public void setCategory_id(int category_id) {
        this.category_id = category_id;
    }
    public float getPrice() {
        return price;
    }
    public void setPrice(float price) {
        this.price = price;
    }
    public boolean getStatus() {return status;}
    public void setStatus(boolean status) { this.status = status; }
    public Date getCreate_time() {
        return create_time;
    }
    public void setCreate_time(Date create_time) {
        this.create_time = create_time;
    }
    public Category getcategory(){return category;}
    public void setCategory(Category category){this.category = category;}
    public User getuser(){return user;}
    public void setUser(User user){this.user = user;}
    public Product() {
        super();
    }
    public Product(int id, String name, String detail, String cover, String pickup_address, String proxy_address,int receiver_id,String phone_number,
                   int category_id, float price, Date create_time, boolean status) {
        super();
        this.id = id;
        this.name = name;
        this.detail = detail;
        this.cover = cover;
        this.pickup_address = pickup_address;
        this.proxy_address = proxy_address;
        this.receiver_id = receiver_id;
        this.phone_number = phone_number;
        this.category_id = category_id;
        this.price = price;
        this.create_time = create_time;
        this.status = status;
    }
}
